﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using xbd.ControlLib;

namespace MYZNMarking
{
    public partial class FrmOutput : Form
    {
        public FrmOutput()
        {
            InitializeComponent();
   
            FrmMain.OutAction = new Action<bool[]>((data2) =>
            {
                Invoke(new Action(() =>
                {
                    foreach (var item in this.groupBox2.Controls.OfType<xbdLed>())
                    {
                        if (item.Tag != null && item.Tag.ToString().Length > 0)
                        {
                            int index = Convert.ToInt32(item.Tag.ToString());
                            item.LedState = data2[index] ? 1 : 0;
                        }
                    }
                }));
            });
            FrmMain.XAction = new Action<bool[]>((data3) =>
            {
                Invoke(new Action(() =>
                {
                    foreach (var item in this.groupBox1.Controls.OfType<xbdLed>())
                    {
                        if (item.Tag != null && item.Tag.ToString().Length > 0)
                        {
                            int index = Convert.ToInt32(item.Tag.ToString());
                            item.LedState = data3[index] ? 1 : 0;
                        }
                    }
                }));
            });
        }
    

    }
}
